const getseries=(data)=>{
    const data1 =data.map(item=>{
        return item.goods_name
    })
    //console.log(data1);
    const arr =[];
    for(let i=0;i<data1.length;i++){
       var flag=true
       for(var j=0;j<arr.length;j++){
           if(data1[i]==arr[j]){
               flag= false
               break
           }
       }
       if(flag){
           arr.push(data1[i])
       }
    }
    const names =arr
    console.log(names);
    var datalast=[];
    for(let i=0;i<names.length;i++){
        datalast.push([])
        data.forEach(item=>{
            if(item['goods_name'] == names[i]){
                datalast[i].push(item['sum(sum_sall)'])
            }
        })
    }
    console.log(datalast);
    var res =new Array(names.length);
    for(let i=0;i<names.length;i++){
        res[i]={
            name:names[i],
            type:'line',
            stack:'总量',
            data:datalast[i]
        }
    }
    return{
        arr:res,
        names:names
    };
}
export default getseries;